package com.cy.pj.common.pool;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author Cx
 * @stage secondStageOfWeb
 * @creat 2020-10-30 16:00
 */

@Scope("prototype")/* 用时才创建 */
//@Lazy/* 无法与prototype一起使用 */
@Component
public class ObjectPool {

    public ObjectPool() {
        System.out.println("ObjectPool.ObjectPool()被创建了");
    }

    @PostConstruct
    public void init() {
        System.out.println("ObjectPool.init");
    }
    @PreDestroy
    public void destroy() {
        System.out.println("ObjectPool.destroy");
    }

}
